import Vue from "vue";
import Router from "vue-router";
// 默认导入目录下的 index.vue 文件，等价于 @/views/login/index.vue
import Login from "@/views/login";
// 布局组件
import Layout from "@/components/Layout.vue";
import Home from "@/views/home";
import User from "@/views/user";
import Menu01 from "@/views/menu01";
import Menu02 from "@/views/menu02";
import Menu03 from "@/views/menu03";
Vue.use(Router);
export default new Router({
  routes: [
    {
      // 登录页
      path: "/login",
      name: "login", //路由名称
      component: Login
    },
    {
      // 基础布局
      path: "/",
      name: "layout",
      component: Layout,
      redirect: "/home", // 重定向到子路由
      children: [
        {
          path: "/home",
          component: Home,
          meta: { title: "首页" }
        }
      ]
    },
    {
      // 用户管理
      path: "/user",
      component: Layout,
      children: [
        {
          path: "/",
          component: User,
          meta: { title: "用户管理" }
        }
      ]
    },
    {
      // 功能菜单一
      path: "/menu01",
      component: Layout,
      children: [
        {
          path: "/",
          component: Menu01,
          meta: { title: "功能菜单一" }
        }
      ]
    },
    {
      // 功能菜单二
      path: "/menu02",
      component: Layout,
      children: [
        {
          path: "/",
          component: Menu02,
          meta: { title: "功能菜单二" }
        }
      ]
    },
    {
      // 功能菜单三
      path: "/menu03",
      component: Layout,
      children: [
        {
          path: "/",
          component: Menu03,
          meta: { title: "功能菜单三" }
        }
      ]
    }
  ]
});
